|
In computing, Microsoft Binary Format (MBF) was a format for floating point numbers used in Microsoft's BASIC language products including MBASIC, GW-BASIC and QuickBasic prior to version 4.00.〔https://support.microsoft.com/en-us/kb/42980〕〔MASM 5.0 Programmer's Guide, p. 133-134. This reference is widely cited, e.g. here http://stackoverflow.com/questions/2686298/convert-pre-ieee-754-c-floating-point-numbers-to-from-c-sharp or here http://collaboration.cmc.ec.gc.ca/science/rpn/biblio/ddj/Website/articles/CUJ/1990/9008/pugh/pugh.htm - read with care though. The second reference could be mistaken to say that QB 4.0 could use MBF internally, but it only uses IEEE. It just has a few conversion functions to convert IEEE floating point numbers to strings containing MBF data, e.g. MKDMBF$ in addition to MKD$ which just copies the bytes of the IEEE value to a string. The MASM 6.1 documentation notes that 5.1 was the last MASM version to support MBF: http://people.sju.edu/~ggrevera/arch/references/MASM61PROGUIDE.pdf〕〔GW-BASIC User's Manual, Appendix D.3 USR Function Calls〕〔BASIC Second edition (May 1982), IBM: Appendix C-15 (This is the BASICA manual.)〕〔http://www.trs-80.com/trs80-zaps-internals.htm#rommath〕 ==History== In 1975, Bill Gates and Paul Allen were working on Altair BASIC, which they were developing at Harvard University on a PDP-10 running their Altair emulator.〔http://news.harvard.edu/gazette/story/2013/09/dawn-of-a-revolution〕 One thing still missing was code to handle floating point numbers, needed to support calculations with very big and very small numbers,〔 which would be particularly useful for science and engineering.〔http://www.sciencedirect.com/science/article/pii/0898122187901817〕〔http://cis.poly.edu/~mleung/CS3734/s05/ch01/floatingPoints2.pdf〕 One of the proposed uses of the Altair was as a scientific calculator.〔https://books.google.nl/books?id=klV_BAAAQBAJ&pg=PA16〕 At a dinner at Courier House, an undergraduate residential house at Harvard, Gates and Allen complained to their dinner companions about having to write this code.〔 One of them, Monte Davidoff, told them he had written floating point routines before and convinced Gates and Allen that he was capable of writing the Altair BASIC floating point code.〔 At the time there was no standard for floating point numbers, so Davidoff had to come up with his own. He decided 32 bits would allow enough range and precision.〔http://altairbasic.org/math_ex.htm〕 When Allen had to demonstrate it to MITS, it was the first time it ran on an actual Altair.〔Triumph of the Nerds〕〔http://www.theregister.co.uk/2001/05/11/microsoft_altair_basic_legend_talks〕 But it worked and when he entered ‘PRINT 2+2’, Davidoff's adding routine gave the right answer.〔 The source code for Altair BASIC was thought to have been lost to history, but resurfaced in 2000. It had been sitting behind Gates's former tutor and dean Harry Lewis's file cabinet, who rediscovered it.〔http://www.theregister.co.uk/2001/05/13/raiders_of_the_lost_altair〕〔https://web.archive.org/web/20020102173701/http://www.rjh.org.uk/altair/ian.htm〕 A comment in the source credits Davidoff as the writer of Altair BASIC's math package.〔〔 Altair BASIC took off and soon most early home computers ran some form of Microsoft BASIC.〔http://www.oldcomputers.net/important-computer-people.html〕〔http://comp.lang.basic.powerbasic.narkive.com/erBpXdwr/basic-7-0-for-windows#post4〕 The BASIC port for the 6502 CPU, such as used in the Commodore PET, took up more space due to the lower code density of the 6502. Because of this it would likely not fit in a single ROM chip together with the machine-specific input and output code. Since an extra chip was necessary, extra space was available and this was used in part to extend the floating point format from 32 bit to 40 bit.〔http://www.pagetable.com/?p=46〕 Not long afterwards the Z80 ports, such as Level II BASIC for the TRS-80 (1978), introduced the 64 bit, double precision format as a separate data type from 32 bit, single precision.〔https://archive.org/details/Level_II_BASIC_Reference_Manual_1st_Ed._1978_Radio_Shack〕〔http://akhara.com/trs-80/docs/model1/Level%20II%20BASIC%20Reference%20Manual%20(1979)(Radio%20Shack)(pdf).zip〕〔https://ia800902.us.archive.org/17/items/BASIC-80_MBASIC_Reference_Manual/BASIC-80_MBASIC_Reference_Manual_text.pdf〕 Microsoft used the same floating point formats in their implementation of Fortran〔http://www.textfiles.com/bitsavers/pdf/microsoft/cpm/Microsoft_FORTRAN-80_Ver3.4_Users_Manual_Nov80.pdf (page 45 and 55)〕 and for their macro assembler MASM,〔ftp://ftp.gwdg.de/pub/mpsf/pc_doc/dosbesch.ps (page 89 and 20)〕 although their spreadsheet Multiplan〔http://www.classiccmp.org/dunfield/kyocera/t200mpln.pdf (page 27 = 42 in the PDF)〕〔Microsoft C Pcode Specifications, page 13; Multiplan wasn't compiled to machine code, but to a kind of byte-code which was ran by an interpreter, in order to make Multiplan portable across the widely varying hardware of the time. This byte-code distinguished between the machine-specific floating point format to calculate on, and an external (standard) format, which was BCD. The PACK and UNPACK instructions converted between the two.〕 and their COBOL implementation used binary coded decimal floating point.〔http://www.textfiles.com/bitsavers/pdf/microsoft/cpm/Microsoft_COBOL-80_1978.pdf (page 26 = 32 in the PDF)〕 Even so, for a while MBF became the de facto floating point format on home computers, to the point where people still occasionally encounter legacy files and file formats using it.〔http://www.textfiles.com/programming/qwk.txt〕〔http://www.csidata.com/patch/csim.txt〕〔https://www.7api.com/converting-microsoft-binary-format-to-ieee-format-using-vb-6-beatfx.html〕〔http://www.tek-tips.com/viewthread.cfm?qid=592713〕〔https://social.msdn.microsoft.com/Forums/vstudio/en-US/64a201b5-852d-41df-9abe-2ad2645cc937/reading-binary-format-qbasic-with-c?forum=netfxbcl〕〔http://r.789695.n4.nabble.com/Reading-MetaStock-data-format-in-R-td4677240.html〕 As early as in 1976, Intel was starting the development of floating point coprocessor.〔http://www.intel.com/content/dam/www/public/us/en/documents/case-studies/floating-point-case-study.pdf〕〔https://www.cs.berkeley.edu/~wkahan/ieee754status/754story.html〕 Intel hoped to be able to sell a chip containing good implementations of all the operations that you'd find in the widely varying maths software libraries.〔〔http://www.drdobbs.com/architecture-and-design/a-conversation-with-william-kahan/184410314〕 John Palmer, who managed the project, contacted William Kahan, who suggested that Intel use the floating point of Digital Equipment Corporation's (DEC) VAX. The first VAX, the VAX-11/780 had just come out in late 1977 and its floating point was highly regarded. However, seeking to market their chip to the broadest possible market, Intel wanted the best floating point possible and Kahan went on to draw up specifications. When rumours of Intel's new chip reached its competitors they started a standardization effort, called IEEE 754, to prevent Intel from gaining too much ground. Kahan got Palmer's permission to participate; he was allowed to explain Intel's design decisions and their underlying reasoning, but not anything related to Intel's implementation architecture.〔〔〔〔http://www.dr-chuck.com/dr-chuck/papers/columns/r3114.pdf〕 VAX's floating point formats differed from MBF only in that it had the sign in the most significant bit.〔http://nssdc.gsfc.nasa.gov/nssdc/formats/VAXFloatingPoint.htm Note that the VAX-11/780 didn't implement the G format yet. Note also that although this is not directly apparent from the tables because the structures have been cut up in two-byte words, the byte order is actually the same as on modern CPUs. There isn't enough room in the exponent range for NaNs, infinities or denormals.〕〔http://www.ece.cmu.edu/~ece447/s15/lib/exe/fetch.php?media=vax_hwhbk_1979.pdf〕 It turns out that for double precision numbers, an 8 bit exponent isn't wide enough for some wanted operations, e.g. to store the product of two 32-bit numbers.〔 Both Kahan's proposal and a counter-proposal by DEC therefore used 11 bits, like the time-tested 60 bits floating point format of the CDC 6600 from 1965.〔http://ygdes.com/CDC/DesignOfAComputer_CDC6600.pdf〕〔〔 Kahan's proposal also provided for infinities, which are useful when dealing with division-by-zero conditions, not-a-number values, which are useful when dealing with invalid operations, denormal numbers, which help mitigate problems caused by underflow,〔https://www.cs.berkeley.edu/~wkahan/ieee754status/why-ieee.pdf〕〔https://www.cs.berkeley.edu/~wkahan/JAVAhurt.pdf〕〔 and a better balanced exponent bias, which can help avoid overflow and underflow when taking the reciprocal of a number.〔https://books.google.nl/books?id=sUD8CAAAQBAJ&pg=PA171〕〔https://www.cs.berkeley.edu/~wkahan/ieee754status/Names.pdf〕 In 1980 the Intel 8087 chip was already released,〔http://micro.magnet.fsu.edu/optics/olympusmicd/galleries/chips/intel8087.html〕 but DEC remained opposed, to denormal numbers in particular, because of performance concerns and since it would give DEC a competitive advantage to standardise on DEC's format. The next year DEC had a study done in order to demonstrate that gradual underflow was a bad idea, but the study concluded the opposite and DEC gave in. In 1985 the standard was ratified, but it had already become the de facto standard a year earlier, implemented by many manufacturers.〔〔〔https://www.cs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF〕 By the time QuickBasic 4.00 was released, the IEEE 754 standard had become widely adopted - for example, it was incorporated into Intel's 387 coprocessor and every x86 processor from the 486 on. Visual Basic also uses the IEEE 754 format instead of MBF. 抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)』 ■ウィキペディアで「Microsoft Binary Format」の詳細全文を読む スポンサード リンク
|